package gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;

import javax.swing.*;
import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableRowSorter;

import sqlstuff.SQLManage;

public class WorkerButtonListener implements ActionListener {

	SQLManage sql;
	public WorkerButtonListener(SQLManage sql) {
		this.sql=sql;
		if(sql == null)
			System.err.println("SQL IS NULL");
		// TODO Auto-generated constructor stub
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println("Worker Added");
		String breed = JOptionPane.showInputDialog("What is the Workers pay?");
		String purpose = JOptionPane.showInputDialog("What is the worker's name?");
		String medStatus = JOptionPane.showInputDialog("What is the worker's position?");
		String sex = JOptionPane.showInputDialog("What is the worker's workshift?");
		String[] args= {"@Pay='"+breed+"', @Name='"+purpose+"', @Position='"+medStatus+"', @Workshift='"+sex+"'"};
		sql.executeSprocWithParams("Add Worker", args);
	}

}
